import unittest

from Autotests.BaseTest import BaseManservSOAPTestCase, PartnerAndAccountAutoCreation


@PartnerAndAccountAutoCreation
class EnumerateMethodsTests(BaseManservSOAPTestCase):
    def test_EnumeratePartners(self):
        for fetchRecursively in [True, False]:
            partners = self.executor.enumeratePartners(self.getPartnerForCaseInfo(), fetchRecursively)
            self.assertIsServiceSequence(partners, self.manserv.createObject('mansvc:ArrayOfPartnerInfo').__class__)

    def test_EnumeratePermissions(self):
        permissions = self.executor.enumeratePermissions()
        self.assertIsInstance(permissions, self.manserv.createObject('mansvc:ArrayOfActionPermissions').__class__)

    def test_EnumerateRecentAggregatedStatisticsHistory(self):
        pass

    def test_EnumerateRegions(self):
        self.assertIsInstance(self.executor.enumerateRegions(),
                              self.manserv.createObject('mansvc:ArrayOfRegionInfo').__class__)

    def test_EnumerateStatisticsHistoryAggregateDescriptors(self):
        self.assertIsInstance(self.manserv.call('EnumerateStatisticsHistoryAggregateDescriptors'),
                              self.manserv.createObject('mansvc:ArrayOfStatisticsAggregateDescriptor').__class__)

    def test_EnumerateStorageNodesByAccountId(self):
        self.assertIsNotNone(self.executor.enumerateStorageNodesForAccount(self.getAccountForCaseInfo()))

    def test_EnumerateTrialActivityIndicators(self):
        pass

    def test_EnumerateRoles(self):
        self.assertIsInstance(self.executor.enumerateUserRoles(),
                              self.manserv.createObject('mansvc:ArrayOfUserRoleInfo').__class__)

    def test_EnumerateUsers(self):
        users = self.executor.enumerateUsers(self.getPartnerForCaseInfo())
        self.assertIsInstance(users, self.manserv.createObject('mansvc:ArrayOfUserInfo').__class__)

if __name__ == "__main__":
    unittest.main()
